home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / swingall.jar / javax / swing / text / StyledEditorKit$FontFamilyAction.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-07-15  |  1.3 KB  |  38 lines

  1. package javax.swing.text;
  2.  
  3. import java.awt.Toolkit;
  4. import java.awt.event.ActionEvent;
  5. import java.util.EventObject;
  6. import javax.swing.JEditorPane;
  7.  
  8. public class StyledEditorKit$FontFamilyAction extends StyledEditorKit.StyledTextAction {
  9.    private String family;
  10.  
  11.    public StyledEditorKit$FontFamilyAction(String var1, String var2) {
  12.       super(var1);
  13.       this.family = var2;
  14.    }
  15.  
  16.    public void actionPerformed(ActionEvent var1) {
  17.       JEditorPane var2 = ((StyledEditorKit.StyledTextAction)this).getEditor(var1);
  18.       if (var2 != null) {
  19.          String var3 = this.family;
  20.          if (var1 != null && ((EventObject)var1).getSource() == var2) {
  21.             String var4 = var1.getActionCommand();
  22.             if (var4 != null) {
  23.                var3 = var4;
  24.             }
  25.          }
  26.  
  27.          if (var3 != null) {
  28.             SimpleAttributeSet var5 = new SimpleAttributeSet();
  29.             StyleConstants.setFontFamily(var5, var3);
  30.             ((StyledEditorKit.StyledTextAction)this).setCharacterAttributes(var2, var5, false);
  31.          } else {
  32.             Toolkit.getDefaultToolkit().beep();
  33.          }
  34.       }
  35.  
  36.    }
  37. }
  38.